Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql: migrate graphql to use async connections #19234

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

bmwill
Copy link
Contributor

@bmwill bmwill commented Sep 5, 2024

Description

Describe the changes or additions included in this PR.

Test plan

How did you test the new or updated feature?


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 4:24pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 4:24pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 4:24pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2024 4:24pm

@bmwill bmwill changed the title migrate graphql to use async connections graphql: migrate graphql to use async connections Sep 5, 2024
@bmwill bmwill marked this pull request as ready for review September 5, 2024 21:09
Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a question about what scope_boxed is doing for us, in case we can't elide it, but otherwise, LGTM!

Comment on lines 62 to 70
.execute(move |conn| {
conn.results(move || {
dsl::packages.filter(dsl::package_id.eq_any(ids.iter().cloned()))
})
async move {
conn.results(move || {
dsl::packages.filter(dsl::package_id.eq_any(ids.iter().cloned()))
})
.await
}
.scope_boxed()
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to have the transactional API execute, execute_repeatable etc accept a callback that it can call scope_boxed on? so that this could become:

            .execute(|conn| async move {
                conn.results(move || {
                    dsl::packages.filter(dsl::package_id.eq_any(ids.iter().cloned()))
                })
                .await
            })

If we can't elide it like that, I'm generally curious to learn more about scope_boxed and when we should and shouldn't use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried for a while to not require this as a part of the trait api but kept hitting lifetime issues bounding the lifetime of the produced future from the provided closure in order to meet the needs of the transaction api diesel-async required. Once i finish this migration i'll take another pass back at this to see if it can be simplified and not require the explicit bounding with scope_boxed

@bmwill bmwill merged commit c8c0f60 into MystenLabs:main Sep 6, 2024
45 checks passed
@bmwill bmwill deleted the graphql-async branch September 6, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants